﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TH_SanPhamAdmin.ascx.cs" Inherits="admin_MyUserControls_TH_SanPhamAdmin" %>
<asp:Label ID="lblStatus" runat="server" CssClass="AdminPageText" 
    Text=""></asp:Label>
<p>
    <asp:Label ID="lblLocation" runat="server" CssClass="AdminPageText" 
        Text="Danh sách các sản phẩm hiện có"></asp:Label>
    <asp:LinkButton ID="lkbtnThemSanPham" runat="server" CssClass="AdminPageText"   
        style="cursor:pointer;float:right;padding-right:5px;font-weight:bold; height: 19px;" 
        onclick="lkbtnThemSanPham_Click">Thêm sản phẩm mới</asp:LinkButton>
</p>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:GridView ID="grid" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="id" Width="100%" onrowdeleting="grid_RowDeleting" 
            AllowPaging="True" PageSize="10" 
            onpageindexchanging="grid_PageIndexChanging" 
            onrowdatabound="grid_RowDataBound">
            <Columns>
                <asp:ImageField DataImageUrlField="HinhMinhHoa" 
                    DataImageUrlFormatString="../../images/products/{0}" HeaderText="Hình ảnh">
                    <ControlStyle Height="75px" Width="75px" />
                </asp:ImageField>
                <asp:TemplateField HeaderText="Tên sản phẩm" SortExpression="TenSanPham">
                    <ItemTemplate>
                        <asp:Label ID="lblTenSanPham" runat="server" Text='<%# Bind("TenSanPham") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="left" Width="200px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Giá" SortExpression="Gia">
                     <ItemTemplate>
                        <asp:Label ID="lblGia" runat="server"  Text='<%# String.Format("{0:#,##0;Nothing}", Eval("Gia")) %>'></asp:Label>
                    </ItemTemplate>
                     <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="80px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Bảo hành" SortExpression="BaoHanh">
                    <ItemTemplate >
                        <asp:Label ID="lblBaoHanh" runat="server" Text='<%# Bind("BaoHanh") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="80px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số lượng tồn" SortExpression="SoLuongTon">
                    <ItemTemplate >
                        <asp:Label ID="lblSoLuongTon" runat="server" Text='<%# Bind("SoLuongTon") %>'></asp:Label>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="100px"/>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:HyperLink Runat="server" Text="Select" 
                          NavigateUrl='<%# "../ChiTietSanPham.aspx?loaisp=" + 
                            Request.QueryString["loaisp"] + "&amp;nsx=" + 
                            Request.QueryString["nsx"] + "&amp;id=" + 
                            Eval("id") %>'
                          ID="HyperLink1">
                        </asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField  HeaderText="">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkbtnDelete" CommandArgument='<%# Eval("id") %>' CommandName="Delete" runat="server">Delete</asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <br />
        <br />
    </ContentTemplate>
</asp:UpdatePanel>
